using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.IO;

namespace CreationFichierMap
{
    public partial class Form1 : Form
    {
        private CreationMap oCreationMap;

        public Form1()
        {
            InitializeComponent();
            oCreationMap = new CreationMap();
        }

        private void btnParcourir_Click(object sender, EventArgs e)
        {
            DialogResult res;

            dlgOpenFile.FileName = "";
            dlgOpenFile.Multiselect = false;
            dlgOpenFile.Title = "Choisir le fichier provenant de MapWin32";
            dlgOpenFile.Filter = "Fichier map (*.txt)|*.txt|Tous les fichiers (*.*)|*.*";
            dlgOpenFile.InitialDirectory = "D:\\Projets vs2005\\ZeldaLOT\\ZeldaLOT\\data\\map";
            
            res = dlgOpenFile.ShowDialog(this);

            if (res == DialogResult.OK)
                txtFichier.Text = dlgOpenFile.FileName;
        }

        private void btnGo_Click(object sender, EventArgs e)
        {
            oCreationMap.ouvrirFichier(dlgOpenFile.FileName);
            oCreationMap.lireFichier();
            oCreationMap.correctionMap();
            oCreationMap.MapDeCollisions();
            oCreationMap.ecrireFichiers(dlgOpenFile.FileName);
        }

        private void Quitter_Click(object sender, EventArgs e)
        {
            Application.Exit();
        }
    }
}